package com.cn.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyInvocationHandler implements InvocationHandler {

	private Person person;
	
	public MyInvocationHandler(Person person) {
		super();
		this.person = person;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		Object ojb = null;
		if(method.getName().equals("eat")){
			System.out.println("检查作业");
			ojb = method.invoke(person, args);
			System.out.println("给成绩");
		}
		return ojb;
	}

}
